package com.hqyj.lyf.controller;

import com.hqyj.lyf.pojo.QuestionBank;

import com.hqyj.lyf.service.QuestionBankService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author Qiuluoer
 *  2022/5/28 16:20
 */
@Controller
@RequestMapping("/qubank")
public class QuestionBankController {
    @Autowired
    private QuestionBankService questionBankService;


    @PostMapping("/quallqu")
    @ResponseBody
    public Map<String,Object> queryAllQuestion(){
        Map<String, Object> map = questionBankService.queryAllQuestion();

        return map;
    }
    @PostMapping("/byqu")
    @ResponseBody
    public Map<String,Object> queryByQuestion(QuestionBank question){

       Map<String,Object> map = questionBankService.queryByQuestion(question);

        return map;
    }
    @PostMapping("/upqu")
    @ResponseBody
    public Map<String,Object> updateQuestion(QuestionBank questionBank){
        Map<String, Object> map = questionBankService.updateQuestion(questionBank);
        return map;

    }
    @PostMapping("/addqu")
    @ResponseBody
    public Map<String,Object> addQuestion(QuestionBank questionBank){
        Map<String, Object> map = questionBankService.addQuestion(questionBank);
        return map;

    }

    @PostMapping("/addqus")
    @ResponseBody
    public Map<String,Object> addQuestions(List<QuestionBank> questions){
        Map<String, Object> map = questionBankService.addQuestions(questions);
        return map;

    }

    @PostMapping("/delqu")
    @ResponseBody
    public Map<String,Object> deleteQuestion(List<Integer> quIds){
        Map<String, Object> map = questionBankService.deleteQuestion(quIds);
        return map;

    }
}
